<script setup>
import { useStore } from 'vuex';

const store = useStore()

const add = () => {
    store.commit('addMoney', 1000)
}

const asyncAdd = () => {
    store.dispatch("addMoneyAsync", 2000)
}
</script>
    
<template>
    <h1>Hello vue3</h1>
    <h1>{{ store.state.money }}</h1>
    <h1>{{ store.getters.double }}</h1>
    <button @click="add">同步加钱1000</button>
    <button @click="asyncAdd">异步加钱2000</button>
</template>
    
    